import {defineStore} from 'pinia'
interface nav{
    title:string,
    name:string,
    content:string
}
interface pathType{
    paths:Array<any>,
    tabss:Set<nav>
}
export const usePath=defineStore('path',{
    state:():pathType=>{
        return{
            paths:[],
            tabss:new Set()
        }
    },
    actions:{
        getToPath(pathList:Array<any>){
            this.paths=pathList
        },
        addTab(tab:any){
            let navItem:nav={
                title:tab?.meta.label,
                name:""+this.tabss?.size,
                content:tab?.path
            }    
            this.tabss?.add(navItem) 
        },
        deleteTab(name:string){
            console.log(name);
            
            this.tabss.forEach(item=>{
                if(item.name==name){
                    this.tabss.delete(item)
                }
            })
        }
    }
})